﻿namespace Digitalmes.Domain.ValueObjects;

/// <summary>
/// 存档数据项值对象。
/// </summary>
public sealed class ArchiveDataItemVo : ValueObject
{
    /// <summary>
    /// 顺序索引，没有默认为 0。
    /// </summary>
    public int Index { get; set; }

    /// <summary>
    /// 分组，默认为空
    /// </summary>
    public string? Group { get; set; } = string.Empty;

    /// <summary>
    /// 数据项名称
    /// </summary>
    [NotNull]
    public string? Name { get; set; } = string.Empty;

    /// <summary>
    /// 值，bool 值转换为 OK/NG，默认为空。
    /// </summary>
    /// <remarks>目前值都按字符串类型存储。</remarks>
    [NotNull]
    public string? Value { get; set; } = string.Empty;

    /// <summary>
    /// 标准值上限
    /// </summary>
    public double? Upper { get; set; }

    /// <summary>
    /// 标准值下限
    /// </summary>
    public double? Lower { get; set; }

    /// <summary>
    /// 判定结果（OK/NG），默认为空。
    /// </summary>
    [NotNull]
    public string? Result{ get; set; } = string.Empty;

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return new object[] 
        {
            Index,
            Name,
            Value,
            Result,
        };
    }
}
